// Main script for module '--- CLUES ---'
//	First sweep: boring. -> test game				Second sweep: improve, do what sells (believable character)


function tNote(){translatorHelp ="X ********** TRANSLATOR: CLUES START HERE: YOU CAN CHANGE THE DIALOG, AS LONG AS THE CLUES STILL MAKE SENSE ********";}
//------------------------------------------------------------------------------------------------------------
var crossEventClue[20];  // only reset when you tell it to: so it records events BETWEEN events
function resetCrossEventClues(){	var i = 0; while (i<20){crossEventClue[i] = 0; i++;} } // force a reset for later
//----------------------------------------------------------------------------------
var dcn;// dcn = default clue number;
function defaultClues()// call after others are said - should never be called
{	if(rcObjectPerson <1)return false; 
	if(!isPerson(rcObjectPerson))return false;    // default clues need TWO people
	if(dcn ==0){say2(storyStar,"I think I'm lost.$It's the human condition, friend.");return true; }
	dcn++;
	return false; //
}
//----------------------------------------------------------------------------------
var pressedF1 =new Boolean(0); var onlySpontaneousClues =new Boolean(0);                            // for room entry clues
function sayOrThink2( who, what){sayOrThink(who,what,2);return true;}// so you don't add the "not a clue" ending 
function readClues()
{ var F1clue =new Boolean(0);
	var rcWho = rcObjectPerson;                         // for brevity
  if(pressedF1)		F1clue =true; 					            // set by pressing F1, which also jumps to Angel's room
  pressedF1 =false; 												          // always reset
  var openEvent	= findFirstOpenEvent();
  // must be with storystar? -------------------------------------------------------
  if(!F1clue){  if(eventDone(USE_SHROUD))             // can he go and see them?
                { if(!inRoom(storyStar))return false ;// then make him walk there
                  if(isPerson(rcWho))													// can't talk to if in other room
                {	if(character[rcWho].Room !=character[storyStar].Room) return false; }
             }  }
  if((rcWho <0)||(rcWho >=CHARACTERS_TOTAL))rcWho =0; // just in case
	if(rcWho >0)
  {	if(!canSpeak(rcWho))return false;
  // must be with player? ----------------------------------------------------------
     if(character[rcWho].Room !=player.Room) return false; // if they are not in the room you say "for some reason" etc.
  	 if((rcWho >0)&&(rcWho <CHARACTERS_TOTAL))
        {  if(character[rcWho].GetProperty("type") > -1)	setFriends(storyStar, rcWho);}
  }
  // special cases? ----------------------------------------------------------------
  if(peopleWhoAreAsleep(rcWho))return true;           // no other dialog to give - it would only call the same again anyway
	if(sameResponseRegardless(rcWho))return true;
  if(rcWho ==LOVER_F) { if(player.Room ==19)return false;} // sick Valentine has her own dialog
  if(rcWho ==SHEPHERD_M)return false;                 // he does not give clues
 //---------------------------------------------------------------------------------
 //
 //
 //
 //
 //----------------------------------------------------------------------------------------------
if(openEvent ==SEE_SHROUD_TOOL) //
{	if(F1clue) // conflict: must
	{	if(clueTalk[1] ==0) say2(storyStar,"");
		if(clueTalk[1] ==1) say2(storyStar,"");
		if(clueTalk[1] >1) say2(storyStar,"");
		clueTalk[1] =clueTalk[1] +1; return true;
	}if(rightClickedObject =="lower wall")// alias "hole"
  { if(clueTalk[2] ==0) sayOrThink2(storyStar,"");
    if(clueTalk[2] ==1) sayOrThink2(storyStar,"");
    if(clueTalk[2] ==2) sayOrThink2(storyStar,"");
    if(clueTalk[2] >2) sayOrThink2(storyStar,"");
    clueTalk[2] =clueTalk[2] +1; return true;
	}if(rcWho ==PURE_F)
	{	clueTalk[5] =clueTalk[5] +1;
		if(clueTalk[5] ==1){if(say2(storyStar,"")) return true;}//
		if(clueTalk[5] ==2){if(say2(storyStar,"")) return true;}//
		if(clueTalk[5] ==3){if(say2(storyStar,"")) return true;}//
		if(clueTalk[5] ==4){if(say2(storyStar,"")) return true;}//
		if(clueTalk[5] ==5){if(say2(storyStar,"")) return true;}//
	}return false;
}
 //-----------------------------------------------------------------------------------
 //
 //
 //
 //
 //----------------------------------------------------------------------------------------------
if(gameOver)
{	if(F1clue){say2(storyStar,"I don't think there's anything else I can do here. I think it's time for another story!");return true;}
}
 return false;
} // end of function
//------------------------------------------------------------------------------------------
function roomEntryClues()
{	onlySpontaneousClues =true;						 // you only want spontaneous dialog then
	var result = =new Boolean(readClues());							 // check spontaneous text
  onlySpontaneousClues =false;	
  return result;
}
//------------------------------------------------------------------------------------------
// end of module
